{include file="header.html"}
<div id="rightTop">
  <p>{$lang.theme_setting}</p>
  <ul class="subnav">
    <!--{if $smarty.get.wait_verify}-->
    <li><a class="btn1" href="index.php?app=theme_setting">{$lang.manage}</a></li>
    <!--{else}-->
    <li><span>{$lang.manage}</span></li>
    <!--{/if}-->
    <li><a class="btn1" href="index.php?app=theme_setting&amp;act=add">{$lang.add}</a></li>
  </ul>
</div>
<div class="mrightTop">
  <div class="fontl">
    <form method="get">
       <div class="left">
          标题:
          <input type="text" name="theme_title" value="{$smarty.get.theme_title}" />
          <input type="hidden" name="app" value="theme_setting" />
          <input type="hidden" name="act" value="index" />
          <input type="submit" class="formbtn" value="{$lang.query}" />
      </div>
      <!--{if $filtered}-->
      <a class="left formbtn1" href="index.php?app=store<!--{if $smarty.get.wait_verify}-->&amp;wait_verify={$smarty.get.wait_verify}<!--{/if}-->">{$lang.cancel_query}</a>
      <!--{/if}-->
    </form>
  </div>
  <div class="fontr">{include file=page.top.html} </div>
</div>
<div class="tdare">
  <table width="100%" cellspacing="0" class="dataTable">
    <!--{if $themes}-->
    <tr class="tatr1">
      <td width="20" class="firstCell"><input type="checkbox" class="checkall" /></td>
      <td class="table-center">ID</span></td>
      <td class="table-center">{$lang.theme_title}</span></td>
      <td class="table-center">有效商品数</td>
      <td class="table-center">点击数</td>
      <td class="table-center">类型</td>
      <td class="table-center">{$lang.theme_url}</span></td>
      <td class="table-center">{$lang.detail_url}</span></td>
      <!--{if !$smarty.get.wait_verify}-->
      <td class="table-center"><span ectype="order_by" fieldname="sort_order">{$lang.sort_order}</span></td>
      <!--{/if}-->
      <td class="table-center">状态</span></td>
      <td class="handler" style="width: 160px;">{$lang.handler}</td>
    </tr>
    <!--{/if}-->
    <!--{foreach from=$themes key=k item=theme}-->
    <tr class="tatr2">
      <td class="firstCell"><input type="checkbox" class="checkitem" value="{$theme.theme_id}" /></td>
      <td class="table-center">{$theme.theme_id}</td>
      <td class="table-center">{$theme.theme_title}</td>
      <td class="table-center" id="count_goods{$k}">0</td>
      <td class="table-center">{$theme.amount}</td>
      <td class="table-center">{$theme.type_value}</td>
      <td class="table-center">{if $theme.theme_url}<img src="{$theme.theme_url}?{$random_number}" height="30"/>{/if}</td>
      <td class="table-center">{if $theme.detail_url}<img src="{$theme.detail_url}?{$random_number}" height="30"/>{/if}</td>
      <!--{if $theme.type eq 1}-->
      <td class="table-center">首页theme轮播图</td>
      <!--{elseif $theme.type eq 2}-->
      <td class="table-center">商品列表轮播图</td>
      <!--{elseif $theme.type eq 3}-->
      <td class="table-center">商品分类轮播图</td>
      <!--{elseif $theme.type eq 4}-->
      <td class="table-center">个人中心轮播图</td>
      <!--{/if}-->
      <!--{if !$smarty.get.wait_verify}-->
      <td class="table-center"><span ectype="inline_edit" fieldname="sort_order" fieldid="{$store.store_id}" datatype="pint" title="{$lang.editable}" class="editable">{$theme.sort_order}</span></td>
      <!--{/if}-->
      <!--{if $theme.preview eq 2}-->
          <td class="table-center">待上架</td>
          <!--{else}-->
          <td class="table-center">已上架</td>
      <!--{/if}-->
      <td class="handler">
        <!--{if !$smarty.get.wait_verify}-->
        <!--{if $theme.preview eq 2}-->
        <a href="javascript:drop_confirm('您确定要上架吗', 'index.php?app=theme_setting&amp;act=cancelPreview&amp;id={$theme.theme_id}&amp;preview=1');">上架</a> |
          <!--{else}-->
        <a href="javascript:drop_confirm('您确定要下架吗', 'index.php?app=theme_setting&amp;act=cancelPreview&amp;id={$theme.theme_id}&amp;preview=2');">下架</a> |
        <!--{/if}-->
        <!--<a href="index.php?app=theme_setting&amp;act=goods_item&amp;id={$theme.theme_id}" >测试</a> |-->

        <a href="javascript:;" class="preview" data-id="{$theme.theme_id}">预览</a> |
        <a href="index.php?app=theme_setting&amp;act=edit&amp;id={$theme.theme_id}">{$lang.edit}</a> | <a href="javascript:drop_confirm('{$lang.drop_confirm}', 'index.php?app=theme_setting&amp;act=drop&amp;id={$theme.theme_id}');">{$lang.drop}</a>
        <!--{else}-->
        <a href="index.php?app=theme_setting&amp;act=view&amp;id={$theme.theme_id}">{$lang.view}</a>
        <!--{/if}--></td>
    </tr>
    <div class ="bg-model{$theme.theme_id}" style="float:right;position:absolute;top:0%;left:44%;display:none;background:rgba(255,255,255,0.3);width:30%;height:100%;">
      <iframe src="index.php?app=theme_setting&act=preview&id={$theme.theme_id}"  width="100%" height="90%" style="background-color: white">
      </iframe>
    </div>
    <!--{foreachelse}-->
    <tr class="no_data">
      <td colspan="12">{$lang.no_data}</td>
    </tr>

    <!--{/foreach}-->
  </table>
  <input type="hidden" name="theme_ids" value="{$ads}">

  <!--{if $theme}-->
  <div id="dataFuncs">
    <div class="pageLinks">
      {include file=page.bottom.html}
    </div>
    <div id="batchAction" class="left paddingT15">
      <input class="formbtn batchButton" type="button" value="{$lang.drop}" name="id" uri="index.php?app=theme_setting&act=drop" presubmit="confirm('{$lang.drop_confirm}');" />
    </div>
  </div>
  <div class="clear"></div>
  <!--{/if}-->


</div>
{include file="footer.html"}
<script>
    $(document).ready(function(){
        var theme_ids = $("input[name=theme_ids]").val();
        $.post("index.php?app=theme_setting&act=theme_ids",{
            theme_ids:theme_ids
        },function(data){
            var res = JSON.parse(data);
            $.each(res,function(index,item){
                $("#count_goods"+item.theme_id).html(item.count_goods)
            })
        })
    })

    $(".preview").click(function () {
        var id = $(this).attr('data-id');
        $("iframe").contents().find(".checkitem:checked");
        $("iframe").contents().find(".checkitem:checked").each(function () {
            $(this).removeAttr('checked');
        })
        $("iframe").contents().items = '';
        $(".bg-model"+id).fadeTo(300,1)
        //隐藏窗体的滚动条
        $("body").css({ "overflow": "hidden" });
    });

</script>